﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Telerik.Web.UI;

public partial class Admin_MembershipProvider_Access_active_users : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    private void Page_PreRender()
    {
        MembershipUserCollection allUsers = Membership.GetAllUsers();
        MembershipUserCollection filteredUsers = new MembershipUserCollection();
        bool isActive;
        if (active.SelectedValue == "Active")
        {
            isActive = true;
        }
        else
        {
            isActive = false;
        }
        foreach (MembershipUser user in allUsers)
        {
            if (user.IsApproved == isActive)
            {
                filteredUsers.Add(user);
            }
        }
        Users1.DataSource = filteredUsers;
        Users1.DataBind();
    }

    protected void Users1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {

    }

    protected void Users1_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        string UserName = (e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserName"].ToString();
        Membership.DeleteUser(UserName, true);
        this.Users1.MasterTableView.Rebind();
    }
}
